/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-07-07 15:34:28
 * @LastEditTime : 2023-07-11 15:01:47
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\ProjectBankPlan.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton } from '../Common/options'
import { OrganizationIdentityLevel } from '../Common/Conversion'

export const ProjectBankPlan = async ({ url, OptionsEvent, ClientData, Permission }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1, OrderField: 'year@desc,month@desc' },
        get: API_LIST()[`get${url}OC`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission.findIndex(v => v.uuid === '144fcbe5-0995-4919-80cc-272fd13de403') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />
            ),
        ],
        columns: [
            commonTableList.uuid,
            // { ...commonTableList.tableName, title: '银行贷款名称', hideInSearch: true },
            {
                dataIndex: 'organizationUuid',
                title: '项目名称',
                valueType: 'select',
                valueEnum: await OrganizationIdentityLevel(4),
                rules: true,
                width: 450,
            },
            {
                dataIndex: 'planBankAmount',
                title: '计划本金(万元)',
                valueType: 'inputNumber',
                hideInSearch: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'interestAmount',
                title: '计划利息(万元)',
                valueType: 'inputNumber',
                hideInSearch: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'yearMonth',
                title: '年月',
                valueType: 'Date',
                hideInSearch: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'year',
                title: '年月',
                valueType: 'dateYear',
                width: 150,
                hideInAdded: true,
                hideInModify: true,
                hideInTable: true,
            },

            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === 'c844ae23-fcd0-4bbf-ac70-0cb31621b617') !== -1 && (
                            <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />
                        ),
                        Permission.findIndex(v => v.uuid === '6cf1bdb1-0bbe-4948-90e0-fbc59b9d19f3') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return data
}
